#include<iostream>
#include<cstdio>
using namespace std;

int main()
{
    int n;
    cin >> n;
    int a[n], max = -1, min = 101;
    double sum = 0;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
        sum += a[i];
        min = (min < a[i]) ? min : a[i];
        max = (max > a[i]) ? max : a[i];
    }
    printf("%.2f\n", (sum - min - max) / (n - 2));
    return 0;
}